package nmf;

import java.util.Random;

import org.ejml.ops.NormOps;
import org.ejml.ops.RandomMatrices;
import org.ejml.simple.SimpleMatrix;

public class SimpleNMFTool extends NMFTool {
   
   @Override
   public void initialize(final SimpleMatrix V, final SimpleMatrix W,
         final SimpleMatrix H, final int[] trainClass) {
      RandomMatrices.setRandom(W.getMatrix(), new Random());
      RandomMatrices.setRandom(H.getMatrix(), new Random());
   }
   
   @Override
   public double cost(final SimpleMatrix V, final SimpleMatrix W, final SimpleMatrix H) {
      return NormOps.fastNormF(V.minus(W.mult(H)).getMatrix());
   }
   
   @Override
   public String toString() {
      return "Simple NMF Tool";
   }
   
   @Override
   public String costString() {
      return "Frobenius Cost";
   }
   
}
